﻿@model IEnumerable<Zatify.Domain.Data.SystemUser>
@{
    Layout = null;
    Response.ContentType = "application/x-ms-excel";
    Response.AddHeader("Content-Disposition", "attachment; filename=UsersReport.xls");//+ Model.fileName);
                //Content-Disposition is defined in RFC-2183
}
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
    <meta name="ProgId" content="Excel.Sheet" />
    <!--[if gte mso 9]><xml>
   <x:ExcelWorkbook>
    <x:ExcelWorksheets>
     <x:ExcelWorksheet>
      <x:Name>Sample Workbook</x:Name>
      <x:WorksheetOptions>
       <x:Print>
        <x:ValidPrinterInfo/>
       </x:Print>
      </x:WorksheetOptions>
     </x:ExcelWorksheet>
    </x:ExcelWorksheets>
   </x:ExcelWorkbook>
  </xml><![endif]-->
</head>
<body>
    <table id="reportTable">
        <thead>
            <tr>
                <th style="background: gray;">
                    Login
                </th>
                <th style="background: gray;">
                    Email
                </th>
                <th style="background: gray;">
                    Phone
                </th>
                <th style="background: gray;">
                    Role
                </th>
                <th style="background: gray;">
                    Status
                </th>
            </tr>
        </thead>
        <tbody>
            @foreach (var systemUser in Model)
            {
                <tr>
                    <td>
                        @systemUser.Login
                    </td>
                    <td>
                        @systemUser.Email
                    </td>
                    <td>
                        @systemUser.Phone
                    </td>
                    <td>
                        @systemUser.Role
                    </td>
                    <td>
                        @(systemUser.IsActive ? "Active" : "Inactive")
                    </td>
                </tr>
            }
        </tbody>
    </table>
</body>
</html>
